# Author    :Dun_Hz
# Time      :2024/3/15 17:05
# 分治算法的汉诺塔问题
class HanoiTower(object):
    def hanoi_tower(self, num, a,b,c):
        if num ==1:
            print("将第1个盘子从"+a+'-->'+c)
        else:
            self.hanoi_tower(num-1,a,c,b)
            print('第'+str(num)+'个盘子从'+a+'-->'+c)
            self.hanoi_tower(num-1,b,a,c)

if __name__=='__main__':
    t= HanoiTower()
    t.hanoi_tower(3,'A','B','C')